package com.wxapp.admin.api.pojo.vm.menu;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import com.wxapp.admin.api.enums.MenuTypeEnum;
import com.wxapp.common.constant.base.IBaseTree;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @author lgl
 * @Description 菜单类
 * @Datetime 2022/7/30 14:04
 * @Modified By
 */
@Data
public class PMenuTreeVm extends IBaseTree<PMenuTreeVm> implements Serializable {

    /**
     * 菜单名称
     */
    @Schema(description = "菜单名称", requiredMode = Schema.RequiredMode.REQUIRED)
    private String name;

    /**
     * 权限标识
     */
    @Schema(description = "权限标识", requiredMode = Schema.RequiredMode.REQUIRED)
    private String permission;

    /**
     * 后台路由
     */
    @Schema(description = "后台路由", requiredMode = Schema.RequiredMode.REQUIRED)
    private String backUrl;

    /**
     * 前端路由
     */
    @Schema(description = "前端路由", requiredMode = Schema.RequiredMode.REQUIRED)
    private String multiUrl;

    /**
     * 显示顺序
     */
    @Schema(description = "显示顺序", requiredMode = Schema.RequiredMode.REQUIRED)
    private Integer orderNum;

    /**
     * 菜单图标
     */
    @Schema(description = "菜单图标", requiredMode = Schema.RequiredMode.REQUIRED)
    private String icon;

    /**
     * 是否为外链（0是 1否）
     */
    @Schema(description = "是否为外链（0是 1否）", requiredMode = Schema.RequiredMode.REQUIRED)
    private Boolean frame;

    /**
     * 菜单类型（M目录 C菜单 F按钮）
     */
    @Schema(description = "菜单类型（M目录 C菜单 F按钮 W 外链）", requiredMode = Schema.RequiredMode.REQUIRED)
    private MenuTypeEnum menuType;

    /**
     * 菜单状态（1显示 0隐藏）
     */
    @Schema(description = "菜单状态（1显示 0隐藏）", requiredMode = Schema.RequiredMode.REQUIRED)
    private Boolean display;
    /**
     * 创建时间 填充策略为插入自动填充
     */
    @Schema(description = "创建时间 ")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
    @JsonDeserialize(using = LocalDateTimeDeserializer.class) //反序列化时
    @JsonSerialize(using = LocalDateTimeSerializer.class) // 序列化时
    private LocalDateTime createTime;
}
